package com.liwq.test;

import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.TimeUnit;

/**
 * @author : liwq
 * @version : 1.0
 * @date : 2023/2/2
 **/
public class BiasedSynchorized {

    public static void main(String[] args) throws InterruptedException {

        //偏向锁。JVM启动4秒后才开启

        TimeUnit.SECONDS.sleep(5);
        Object o = new Object();
        System.out.println(ClassLayout.parseInstance(o).toPrintable());

        synchronized (o) {
            o.hashCode();
            System.out.println("进来了");
        }


        System.out.println(ClassLayout.parseInstance(o).toPrintable());


    }
}
